<!--
 @description 三级导航
 @fileName ThreeNavList.vue
 @author zengqiongying
 @created 2022/12/29 17:37:45
-->
<template>
  <div class="com-page">
    <MineHeader arrow :title="pageName" />
    <div>
      <NavList :list="list" />
    </div>
  </div>
</template>

<script>
import MineHeader from '@/components/MineHeader'
import NavList from './components/NavList'
export default {
  name: 'GoodsThreeNavList',
  components: { MineHeader, NavList },
  filters: {},
  mixins: [],
  data() {
    return {
      pageName: '',
      list: []
    }
  },

  computed: {},

  created() {
    const str = localStorage.getItem('three-nav-list')
    if (str) {
      try {
        const obj = JSON.parse(str)
        this.pageName = (obj && obj.tabName) || ''
        this.list = (obj && obj.children) || []
      } catch (error) {
        localStorage.removeItem('three-nav-list')
      }
      localStorage.removeItem('three-nav-list')
    }
    if (this.list.length === 0) {
      this.$router.go(-1)
    }
  },
  activated() {},
  beforeDestroy() {
    localStorage.removeItem('three-nav-list')
  },
  beforeRouteLeave(to, from, next) {
    if (to.name === 'GoodsIndex') {
      this.$removeKeepAliveCache(this)
    }
    next()
  },
  mounted() {},

  methods: {
    handleClick(data) {
      data.routerTitle = data.tabName
      this.$gotoPage(data)
    }
  }
}

</script>
<style lang='less' scoped>
.com-page{
  padding-top: 44PX;
}
</style>
